package com.wxg.demo;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.Point;
import org.openqa.selenium.Rectangle;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

import com.wxg.utils.MyDriver;

public class ElementHeight101 {

	public static void main(String[] args) {
		code103();
	}
	
	public static void code101(){
		WebDriver driver = MyDriver.getFirefoxDriver();
		driver.get("http://localhost:8080/myjfserver/uehtml/html_101.html");
		List<WebElement> eleList = driver.findElements(By.tagName("p"));
		if(null != eleList){
			System.out.println( eleList.size() );
			for(WebElement ele : eleList){
				Rectangle rect = ele.getRect();
				System.out.printf("\n\nx: %s, y: %s, width: %s, height: %s", rect.x, rect.y, rect.width, rect.height);
			}
		}
		driver.quit();
	}
	
	public static void code102(){
		WebDriver driver = MyDriver.getChromeDriver();
		driver.get("http://localhost:8080/myjfserver/uehtml/html_101.html");
		List<WebElement> eleList = driver.findElements(By.tagName("p"));
		if(null != eleList){
			System.out.println( eleList.size() );
			for(WebElement ele : eleList){
				Point point = ele.getLocation();
				Dimension dimension = ele.getSize();
				System.out.printf("\n\nx: %s, y: %s, width: %s, height: %s", point.x, point.y, dimension.width, dimension.height);
			}
		}
		driver.quit();
	}
	
	public static void code103(){
		WebDriver driver = MyDriver.getHtmlUnitDriver();
		driver.get("http://localhost:8080/myjfserver/uehtml/html_101.html");
		List<WebElement> eleList = driver.findElements(By.tagName("p"));
		if(null != eleList){
			System.out.println( eleList.size() );
			for(WebElement ele : eleList){
				Point point = ele.getLocation();
				Dimension dimension = ele.getSize();
				System.out.printf("\n\nx: %s, y: %s, width: %s, height: %s", point.x, point.y, dimension.width, dimension.height);
			}
		}
		driver.quit();
	}
}
